package com.xiyou.weblog.common.domain.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xiyou.weblog.common.domain.dos.UserRoleDao;

import java.util.List;

/**
 * @author xiyoo
 * @description 用户权限表
 */
public interface UserRoleMapper extends BaseMapper<UserRoleDao> {

    /**
     * 根据用户名查询
     * @param username 目标用户名
     * @return 目标用户
     */
    default List<UserRoleDao> selectByUsername(String username) {
        LambdaQueryWrapper<UserRoleDao> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserRoleDao::getUsername, username);
        return selectList(wrapper);
    }
}
